﻿using System;

using E.BLL;
using E.Web.UI.Page;

using X.Common;

namespace E.Web.training.signup
{
    public partial class SignUp : BasePage
    {
        protected override void ShowPage()
        {
            if (ispost)
            {
                int classid = XRequest.GetInt("CIDValue", -1);
                int relationid = XRequest.GetInt("CRIDValue", -1);
                int signuptypeid = XRequest.GetInt("signuptypeid", -1);
                if (classid == -1 || relationid == -1)
                {
                    ExecuteJS("alert('报名错误'); history.back();");
                }
                else
                {
                    int rst = (new ClassBLL()).SignUp(userid, classid, relationid,signuptypeid);
                    if (rst > 0)
                    {
                        ExecuteJS("alert('报名成功'); window.location = '/training/signup/Register.aspx';");
                    }
                    else
                    {
                        ExecuteJS("alert('很抱歉，不能报名该班级，请选择其他班级，谢谢'); history.back();");
                    }
                }
            }
        }
    }
}
